package it.traveldreamWeb.customer;

import it.traveldream.beans.BookingManagerInterface;
import it.traveldream.dto.ReservationDTO;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

@ManagedBean(name="reservationListBean")
@ViewScoped
public class ReservationListBean {

	@EJB
	private BookingManagerInterface bookingManager;
	
	private List<ReservationDTO> reservations;
	
	@ManagedProperty(value="#{reservationBean}")
	private ReservationBean session;
	
	@PostConstruct
	private void init(){
		this.session.cleanMessages();
		
		this.session.initCustomer();
		this.reservations = this.session.getCustomer().getReservations();
	}

	public List<ReservationDTO> getReservations() {
		return this.reservations;
	}

	public void setReservations(List<ReservationDTO> reservations) {
		this.reservations = reservations;
	}

	public ReservationBean getSession() {
		return this.session;
	}

	public void setSession(ReservationBean session) {
		this.session = session;
	}
}
